//index.js
//获取应用实例
const app = getApp()
const cityList = require('../../utils/city.js');
Page({
  data: {
    title:"城市选择",
    currentCity:{},
    cityList:[]
  },
  onLoad: function () {
    let city = wx.getStorageSync("DT-CITY");
    let currentCity = cityList.find(v => v.label == city) || {};
    this.setData({
      currentCity,
      cityList: cityList
    })
  },
  switchCity(event){
    console.log(event);
    let data = event.target.dataset;
    let city = data.value.label;
    wx.setStorageSync("DT-CITY", city);
    wx.navigateBack({
      delta:1
    })
  }
})
